<?
// sunsblog.net CMS (c) 2004 Gjokica Zafirovski
require("../include/session.inc");
require ("../include/functions.inc");
require_once("verify_login.php");

openConnection();

if(!empty($HTTP_POST_FILES["slika"])) {
    //copy the file to some permanent location
    if (move_uploaded_file($HTTP_POST_FILES["slika"]["tmp_name"], $uploaddir . $HTTP_POST_FILES["slika"]["name"])) {
        $slika = $HTTP_POST_FILES["slika"]["name"];
	chmod($uploaddir . $slika, 0644);
    } else {
      $slika = "";
      // echo ("Greska vo slikata!");
      // exit;
    }
}

$sql = "update $tbl_lokacija set ime='$ime', ";
if($HTTP_POST_FILES["slika"]["name"] != ""){
  $sql .= "slika='$slika', "; 
}
$sql .="voved='$voved' where id='$l_id'";
//die($sql);
$res = mysql_query ($sql)
	or die("No update. Try again sunser!");

header("location:index.php");
?>